
PLUG.Platform = PLUG_PLATFORM_SHARED

PLUG.ClassName = "sh_chatnotices"
PLUG.PrintName = "Chat Notices"
PLUG.Author = "thomasfn"

PLUG.Hard = true

if (SERVER) then

	function PLUG:SendChatNotice( notice, private )
		if (!private) then
			// PrintMessage( HUD_PRINTTALK, notice )
			self:CustomChatNotice( notice )
			return
		end
		for _, v in pairs( player.GetAll() ) do
			if (v:HasPriv( "private_chat" )) then self:CustomChatNotice( notice, v ) end
		end
	end
	
	function PLUG:CustomChatNotice( msg, to )
		umsg.Start( "gmanage", to )
			umsg.String( "chatmessage" )
			umsg.String( msg )
		umsg.End()
	end

end

if (CLIENT) then

	local grey = Color( 128, 128, 128 )
	function PLUG:UserMessage( tag, um )
		if (tag == "chatmessage") then
			chat.AddText( grey, "GManage: ", color_white, um:ReadString() )
		end
	end

end